﻿namespace RssReader
{
    public class LocalSettings
    {
        readonly Windows.Storage.ApplicationDataContainer _localSettings =
                Windows.Storage.ApplicationData.Current.LocalSettings;

        private const string ItemKey = "clickedItem";

        public void Remove_setting(string settingKey)
        {
            var key = _localSettings.Values[settingKey];
            if (key != null) _localSettings.Values.Remove(settingKey);
        }

        public void Store_value(string settingKey, string value)
        {
            _localSettings.Values[settingKey] = value;
        }

        public object Get_value(string settingKey)
        {
            return _localSettings.Values[settingKey];
        }

        public string Get_stored_clicked_item_title()
        {
            return (string) _localSettings.Values[ItemKey];
        }

        public void Store_clicked_item_title(string title)
        {
            _localSettings.Values[ItemKey] = title;
        }

        public void Remove_clicked_item_title()
        {
            this.Remove_setting(ItemKey);
        }
    }
}
